#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
User: lyj
DateTime: 2012-04-14 21:55:00

"""

__author__ = 'lyj'



import consumer

c = consumer.Consumer(host='localhost', userid='guest', password='guest')
c.declare_exchange(exchange_name='integers')
c.declare_queue(queue_name='evens', routing_key='even')

def message_callback(message):
    print 'even integer: %s' % message.body
    c.channel.basic_ack(message.delivery_tag)
    c.publish('', message.body, 'hello')

c.start_consuming(message_callback)
c.wait()
